<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return['diy']=$this->plugin_setting('diy');
$basic=$this->plugin_setting('basic');
$return['hdps']=$basic['hdps'];
if($_RQ['op']=='main'){
	set_html('title','医生列表');
	exi($return);
}
if($_RQ['op']=='getlist'){
	$post=get_postdata();
	$params=array('uniacid'=>$_SESSION['uniacid'],'status'=>1);
	$type=intval($_RQ['type']);
	$worker_ids=pdo_getall('jy_zhongyi_worker_like',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']),array('id','worker_id'),'worker_id');
	if($worker_ids){
		$worker_ids=array_keys($worker_ids);
		$params['id']=$worker_ids;
	}else{
		$params['id']=0;
	}
	//排序医生
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$return['status']=0;
	$parameter=array(
		'params'=>$params,
		'limit'=>array($pindex,$psize),
		'fields'=>$fields,
		'orderby'=>$orderby,
	);
	$list=pdo_getslice('jy_zhongyi_worker',$params,array($pindex,$psize),$total,$fields,'','id desc');
	$sum=0;
	if($list){
		$sum=count($list);
		foreach($list as &$item){
			$label=str_array($item['label']);
			$item['label']=array();
			foreach($label as $lv){
				$item['label'][]=pdo_get('jy_zhongyi_label',array('id'=>$lv,'uniacid'=>$_SESSION['uniacid']));
			}
			$item['createtime']=date('Y-m-d H:i:s',$item['createtime']);
			$item['lessontitle']=pdo_getcolumn('jy_zhongyi_lesson',array('id'=>$item['lesson_id']),'title');
			$item['storetitle']=pdo_getcolumn('jy_zhongyi_store',array('id'=>$item['storeid']),'title');
		}
	}
	$return['list']=$list;
	$return['sum']=$sum;
	exi($return);
}
